Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true // 启用多 slot 支持
  },
  data: {
    visible: false
  },
  methods: {
    cancel() {
      this.data.success({ confirm: false })
      this.close()
    },
    confirm() {
      this.data.success({ confirm: true })
      this.close()
    },
    close() {
      this.setData({
        visible: false
      })
    },
    nothing() {
      return;
    },
    open(params = {}) {
      const { 
        success, 
        title = '提示', 
        desc = '描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述', 
        cancelText = '取消', 
        confirmText = '确定' 
      } = params
      this.setData({
        visible: true,
        title,
        desc,
        cancelText,
        confirmText
      })
      // this.setDialogData('title',title)
      // this.setDialogData('desc',desc)
      // this.setDialogData('cancelText',cancelText)
      // this.setDialogData('confirmText',confirmText)

      this.data.success = success

    },
    // setDialogData(key,value){
    //   this.setData({
    //     [`${key}`]:value
    //   })
    // }
  }
});
